package com.sand.controller;

import com.sand.dto.worker.AddProjectWorker;
import com.sand.dto.worker.DownProjectWorkers;
import com.sand.result.ResponseResult;
import com.sand.service.Project_workerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


//工人工程接口
@RestController
@RequestMapping("/project_worker")
public class Project_workerController {

    @Autowired
    private Project_workerService projectWorkerService;


    /**
     * 安排工人干活
     */
    @PostMapping("/add")
    public ResponseResult<Integer> add(@RequestBody AddProjectWorker[] list){
        Integer i = projectWorkerService.add(list);
        return new ResponseResult<Integer>().ok(i);
    }


    /**
     *解雇工人
     */
    @PostMapping("/down")
    public ResponseResult<Integer> down(@RequestBody DownProjectWorkers downProjectWorkers){
        Integer i =  projectWorkerService.down(downProjectWorkers);
        return new ResponseResult<Integer>().ok(i);
    }


}
